/*
 * Employee.java
 *
 * Created on 20 marzec 2007, 19:37
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package data;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 *
 * @author xavex
 */
public class Employee implements Serializable, IDbObject {
    
    private Long id;
    private String name;
    private Team team;
    private boolean locked;
    private Set<Vacation> vacations = new HashSet<Vacation>();
    
    /** Creates a new instance of Employee */
    public Employee() {
    }
    

    public Long getId() {
        return this.id;
    }

    private void setId(final Long id) {
        this.id = id;
    }

    public String getName() {
        return this.name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public Team getTeam() {
        return this.team;
    }

    public void setTeam(final Team team) {
        this.team = team;
    }

    public boolean isLocked() {
        return this.locked;
    }

    public void setLocked(final boolean isLocked) {
        this.locked = isLocked;
    }

    public Set<Vacation> getVacations() {
        return this.vacations;
    }

    public void setVacations(final Set<Vacation> vacations) {
        this.vacations = vacations;
    }
    
    public String toString()
    {
        return getName();
    }
    
    public boolean equals(Object aThat)
    {
      if ( this == aThat ) return true;
      if ( !(aThat instanceof Employee) ) return false;

      if( id == null )
          return super.equals( aThat );
      else
          return this.id.equals( ((Employee)aThat).id );
    }
    
    public int hashCode()
    {
        if( id != null )
            return id.hashCode();
        else
            return super.hashCode();
    }
}
